package mobile.pubcrawler;

import java.util.ArrayList;

import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

@SuppressWarnings("unchecked")
public class MapOverlays extends ItemizedOverlay {

	private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
	
	public MapOverlays(Drawable defaultMarker) {
		super(boundCenter(defaultMarker));
	}

	public void addOverlay(OverlayItem overlay) {    
		mOverlays.add(overlay);    
		populate();
	}
	
	/*public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		
		OverlayItem oi = mOverlays.get(mOverlays.size()-1);
		GeoPoint p = oi.getPoint();
		Paint paint = new Paint();
		// Converts lat/lng-Point to OUR coordinates on the screen.
		Point myScreenCoords = new Point();
		mapView.getProjection().toPixels(p, myScreenCoords);
		paint.setStrokeWidth(1);
		paint.setARGB(255, 255, 255, 255);
		paint.setStyle(Paint.Style.STROKE);
		
		canvas.drawText("Hallo", myScreenCoords.x, myScreenCoords.y, paint);
		super.draw(canvas, mapView, shadow);
	}*/
	
	protected OverlayItem createItem(int i) {
		return mOverlays.get(i);
	}

	public int size() {
		return mOverlays.size();
	}

}
